package com.huawei.appmarket.oobe.store;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Build;
import androidx.annotation.RequiresApi;
import com.huawei.appgallery.serverreqkit.api.bean.BaseResponseBean;
import com.huawei.appgallery.serverreqkit.api.bean.ResponseBean;
import o.azc;
import o.bke;
import o.cvt;
import o.BaseRequest;
import o.dld;
import o.dli;
import o.dlw;
import o.Logger;
import o.doi;
import o.dok;
import o.ContentManager;
import o.ll;

public class OOBEQueryIfSupportTask extends dlw {
    private int ˊ = 0;

    public static class OOBESupportResponse extends BaseResponseBean {
        public static final int SUCCESS = 0;
        private int appUpdateNotify_ = 0;
        private String desktopLayout_;
        private int isNotifyNotRemoveable_;
        private int isServiceZone_;
        private int isSimChangeNotify_ = 0;
        private int maxDisplay_;
        private int notifyIntervalTime_;
        private int skipSwitch_ = 1;

        public int ˏ() {
            return this.isServiceZone_;
        }

        public int ˎ() {
            return this.maxDisplay_;
        }

        public int ˋ() {
            return this.isSimChangeNotify_;
        }

        public int ॱ() {
            return this.isNotifyNotRemoveable_;
        }

        public int ˊ() {
            return this.skipSwitch_;
        }

        public int ʻ() {
            return this.appUpdateNotify_;
        }

        public int ʼ() {
            return this.notifyIntervalTime_;
        }

        public String ᐝ() {
            return this.desktopLayout_;
        }
    }

    public static class c extends cvt {
        public static final String APIMETHOD = "client.https.isOpenService";
        private int changeID_ = -1;
        private String channelInfo_;
        private String deliverCountry_;
        private int emuiApiLevel_ = 0;
        private String firmwareVersion_;
        private String mcc_;
        private String mnc_;
        private int oobeMarket_;
        private int oobe_;
        private String phoneBuildNumber_;
        private String phoneType_;
        private String version_;
        private String vnk_;

        public static RequestStrategy ˋ() {
            RequestStrategy cVar = new RequestStrategy();
            cVar.setMethod_(APIMETHOD);
            cVar.setStoreApi("clientApi");
            return cVar;
        }

        public boolean isNeedRecallFront() {
            return false;
        }

        public String ˎ() {
            return this.deliverCountry_;
        }

        public void ˏ(String str) {
            this.deliverCountry_ = str;
        }

        public void ˋ(String str) {
            this.mnc_ = str;
        }

        public void ॱ(String str) {
            this.mcc_ = str;
        }

        public void ˊ(String str) {
            this.phoneType_ = str;
        }

        public void ˎ(String str) {
            this.firmwareVersion_ = str;
        }

        public void ʼ(String str) {
            this.phoneBuildNumber_ = str;
        }

        public void ˊ(int i) {
            this.emuiApiLevel_ = i;
        }

        public void ʽ(String str) {
            this.version_ = str;
        }

        public void ˏ(int i) {
            this.oobe_ = i;
        }

        public String ˊ() {
            return this.vnk_;
        }

        public void ॱॱ(String str) {
            this.vnk_ = str;
        }

        public void ᐝ(String str) {
            this.channelInfo_ = str;
        }

        public void ˋ(int i) {
            this.oobeMarket_ = i;
        }

        public void ˎ(int i) {
            this.changeID_ = i;
        }
    }

    public OOBEQueryIfSupportTask(Context context, int i) {
        super(context);
        this.ˊ = i;
    }

    @RequiresApi(api = 21)
    public cvt ˏ() {
        int i = 1;
        cvt ˋ = c.ˋ();
        ˋ.setSign_(null);
        ˋ.ˏ(dld.ˎ().ॱˋ());
        ˋ.setLocale_(doi.ॱ());
        ˋ.ˊ(Build.MODEL);
        ˋ.setServiceType_(0);
        ˋ.ˎ(dok.ˏ());
        ˋ.ˊ(azc.ˎ().ॱ());
        ˋ.ˏ(1);
        Context ˋ2 = ContentManager.getInstant().getContext();
        try {
            ˋ.ʽ(ˋ2.getPackageManager().getPackageInfo(ˋ2.getPackageName(), 0).versionName);
        } catch (NameNotFoundException e) {
            Logger.ˎ("OOBE", "getPackageInfo exception");
        }
        ˋ.ॱॱ(dli.ˏ());
        ˋ.ᐝ(dli.ʼ(ˋ2));
        if (!dli.ᐝ(ˋ2)) {
            i = 2;
        }
        ˋ.ˋ(i);
        ˋ.ˎ(dli.ॱˊ(ˋ2));
        ˋ.ʼ(dli.ˏ(ˋ2) ? dli.ˎ() : "");
        ˋ.ॱ(bke.ˎ());
        ˋ.ˋ(bke.ˏ());
        return ˋ;
    }

    public void notifyResult(BaseRequest o_cvu, ResponseBean responseBean) {
        boolean z = false;
        boolean z2 = true;
        Context ˋ = ContentManager.getInstant().getContext();
        Intent intent = new Intent("com.huawei.appmarket.oobe.ACTION_SUPPORT_QUERY_FINISHED");
        intent.addFlags(268435456);
        intent.putExtra("fromWhere", this.ˊ);
        if (responseBean != null) {
            OOBESupportResponse oOBESupportResponse = (OOBESupportResponse) responseBean;
            if (oOBESupportResponse.getResponseCode() == 0 && oOBESupportResponse.getRtnCode_() == 0) {
                boolean z3;
                boolean z4;
                boolean z5;
                boolean z6 = oOBESupportResponse.ˏ() == 1;
                Logger.ˎ("OOBE", "OOBEQueryIfSupportTask isSupport=" + z6);
                int ˎ = oOBESupportResponse.ˎ();
                if (oOBESupportResponse.ˋ() == 1) {
                    z3 = true;
                } else {
                    z3 = false;
                }
                if (oOBESupportResponse.ॱ() == 1) {
                    z4 = true;
                } else {
                    z4 = false;
                }
                if (oOBESupportResponse.ˊ() == 1) {
                    z5 = true;
                } else {
                    z5 = false;
                }
                if (oOBESupportResponse.ʻ() != 1) {
                    z2 = false;
                }
                int max = Math.max(oOBESupportResponse.ʼ(), 14);
                intent.putExtra("isSupport", z6);
                intent.putExtra("maxDisplay", ˎ);
                intent.putExtra("simChangeNotify", z3);
                intent.putExtra("notificationNotRemovable", z4);
                intent.putExtra("notificationFlowSupport", z5);
                intent.putExtra("appUpdateNotify", z2);
                intent.putExtra("appListCheckIntervalTime", max);
                String ᐝ = oOBESupportResponse.ᐝ();
                if (ᐝ != null && dli.ˏ(ˋ) && z6) {
                    if (ᐝ.length() < 524288000) {
                        intent.putExtra("layoutData", ᐝ);
                    } else {
                        Logger.ˋ("OOBE", "too much layout data, ignore");
                    }
                }
                dld.ˎ().ˎ(((c) o_cvu).ˊ());
                dli.ˊ(ˋ).edit().putString("serviceZone", ((c) o_cvu).ˎ()).commit();
                z = z6;
            } else {
                Logger.e("OOBE", "OOBEQueryIfSupportTask failed. responseCode=" + oOBESupportResponse.getResponseCode() + " returnCode=" + oOBESupportResponse.getRtnCode_());
            }
        }
        intent.putExtra("isSupport", z);
        ll.ˏ(ˋ).ˋ(intent);
    }
}
